<template>
  <div class="global-container">
    <div class="form-main">
      <el-form
        :model="formData"
        ref="form"
        label-width="100px"
        class="form"
        
      >
        <el-form-item label="处理人">{{ formData.scPer }}</el-form-item>
        <el-form-item label="处理时间">
          {{ formData.scTime }}
        </el-form-item>
        <el-form-item
          label="审查结果"
          prop="processResult"
          :rules="$validate.required()"
        >
          <Aradio
            v-model="formData.processResult"
            :options="[
              { label: '准予许可', value: '5' },
              { label: '不予许可', value: '4' }
            ]"
            :disabled="disabled"
          ></Aradio>
        </el-form-item>
        <el-form-item
          label="处理意见"
          prop="scAdvice"
          :rules="$validate.maxLength(true, 1,100)"
        >
          <el-input
            v-model="formData.scAdvice"
            type="textarea"
            placeholder="请输入处理意见"
            :disabled="disabled"
          ></el-input>
        </el-form-item>
        <template v-if="needUploadCertFile">
          <el-form-item label="电子证照" prop="certUrl" :rules="$validate.required()">
            <BtnUpload
                v-model="formData.certUrl"
                businessTable="TB_APPLY"
                :businessId="id"
                subType="certFile"
                btn-text="上传文件"
                :disabled="disabled"
                @change="$refs.form.validateField('certUrl')"
            />
          </el-form-item>
        </template>
        <template v-else>
          <el-form-item label="附件" prop="scFile.id">
            <BtnUpload
                v-model="formData.scFile"
                businessTable="TB_APPLY"
                :businessId="id"
                subType="process"
                btn-text="上传文件"
                :disabled="disabled"
                @change="$refs.form.validateField('scFile.id')"
            />
          </el-form-item>
        </template>

      </el-form>
    </div>
  </div>
</template>
<script>
import BtnUpload from '@/components/Upload/BtnUpload';
import Aradio from '@/components/Radio/Aradio';
export default {
  props: {
    disabled: {
      default: false,
      type: String || Boolean
    },
    id: {
      type: String
    },
    formData: {
      default: () => ({}),
    },
  },
  components: {
    BtnUpload,
    Aradio,
  },
  data() {
    return {
    };
  },
  computed: {
    needUploadCertFile() {
      console.log("??")
      return (this.formData.bussType !== '4' && this.formData.bussType !== '9' && this.formData.bussType !== 'd')
          && this.formData.serviceType === '3'
          && (this.formData.processResult && this.formData.processResult === '5')
    }
  },
  methods: {
    // 校验表单
    checkValidate() {
      return this.$validate.checkValidate(this.$refs.form);
    }
  },
};
</script>
<style lang="scss" scoped>
.global-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.form-main {
  width: 600px;
}
</style>
